<template>
	<view class="zui-button">
		<view class="btn_box" v-if="type==1">
			<button @click="do_fun" class="anBtn" :style="'background-color: '+bgColor+';color:'+color+';'"><slot></slot></button>
		</view>
	</view>
</template>
<script>
	export default {
		props: {
			color:{
				type: String,
				default: '#fff'
			},
			bgColor:{
				type: String,
				default: '#EEAE4F'
			},
			type: {
				type: String,
				default: '1'
			},
			fun:{
            type: Function,
                  default: () => { 
                    return Function;
                  },
        },
		},
		data() {
			return {
			}
		},
		onLoad(e) {
			
		},
		created: function() {
			
		},
		methods: {
			do_fun(){
				this.shake(()=>{
					console.log('内部调用了',this.fun);
					// this.fun()
					this.$emit('fun')
				})
			}
		}
	}
</script>
<style lang="scss" scoped>
	.zui-button{
			flex: 1;
	
	.btn_box { 
	
		padding-bottom: constant(safe-area-inset-bottom); /* 兼容 iOS < 11.2 */
		padding-bottom: env(safe-area-inset-bottom); /* 兼容 iOS >= 11.2 */
		box-sizing: border-box;
		// width: 690rpx;
		margin: 0 auto;
		padding: 30rpx;
		
	}
	.anBtn {
		height: 100rpx;
		line-height: 100rpx;
		border-radius: 50rpx;
		color: #fff;
		font-size: 30rpx;
		transform: scale(1);
		transition: all 0.25s;
		font-weight: bold;
	}
	.anBtn:active {
		transform: scale(0.9);
		opacity:0.9;
	}
		
	.anBtn::after {
		border: 0;
	}
		
	.anBtn[disabled] {
		opacity:0.9;
	}
	.anBtn[disabled]:active {
		transform: scale(1);
		opacity:0.9;
	}
	.anBtn[disabled]:not([type]) {
		transform: scale(1);
		opacity:0.9;
	}
	
	}
</style>
